import { createStore } from 'redux'
import AsyncStorage from '@react-native-async-storage/async-storage'
import { persistStore, persistReducer } from 'redux-persist'
import reducers from './reducers'

const persistConfig = {
    key: 'root',
    storage: AsyncStorage,
    // 如果您想要在黑名单中排除一个嵌套对象的属性，您可以在数组中使用点号（'.'）来指定属性的路径。例如：user.profilePicture
    blacklist: ['isLoading', 'errorMessage']
}

const persistedReducer = persistReducer(persistConfig, reducers)

const store = createStore(persistedReducer)
const persistor = persistStore(store)

export default store
export { persistor }
export * from './constants'
